package com.lovo.user.mq;

import com.lovo.common.util.MQUtil;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = {"shop.fanout.queue.a","shop.fanout.queue.b"})
public class FanoutReceiver {
    @Autowired
    private MQUtil mqUtil;
    @RabbitHandler
    public void receive(String content, Message message, Channel channel){
        System.out.println("接收消息Fanout：" + content);
        mqUtil.ack(message,channel);
    }
}
